package function

class ClassTraner(val name: String, val age: Int) {
  def sayHi(): Unit = {
    println(s"hi from person ${name}")
  }
}

object ClassTraner {
  def main(args: Array[String]): Unit = {
    //类型检查与转换
    val person: Person1 = new Person1("alice", 18)
    person.study()
    person.sayHi()
    println(s"student is ClassTraner: ${person.isInstanceOf[ClassTraner]}")
    println(s"student is Person1: ${person.isInstanceOf[Person1]}")
  }
}

class Person1(name: String, age: Int) extends ClassTraner(name, age) {
  override def sayHi(): Unit = {
    println(s"hi from student ${name}")
  }

  def study(): Unit = {
    println("student study")
  }
}

//定义枚举类对象，继承自Enumeration
object WworkDay extends Enumeration with App {
  val MONDAY = Value(1, "Monday")
  val TUESDAY = Value(2, "TuesDay")
  println(MONDAY + "  " + TUESDAY)


}

//定义应用类对象,继承自App类，自带main方法
object TestApp extends App {
  println("app start")


}